<!doctype html>



  


<html class="theme-next mist use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>



<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />












  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.0" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="工具插件," />








  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.1.0" />






<meta name="description" content="之前在blog中嵌入代码都是使用markdown格式的代码嵌入功能，这样虽然很方便但是今天在技术blog上发现一种更利于展示前端代码demo的方式，就是类似于jsbin的在线编辑器。打开jsbin官网，界面类似于界面可以直观的看到html，js，css，控制台和输出视图。可以选择各板块是否显示。 插入js，css库推荐手动找到相应库的cdn直接用标签在html板块中引入。点Add library直">
<meta name="keywords" content="工具插件">
<meta property="og:type" content="article">
<meta property="og:title" content="前端代码演示神器jsbin">
<meta property="og:url" content="http://lanbos.win/2017/06/01/tools/jsfiddle_base/index.html">
<meta property="og:site_name" content="lanbos&#39;blog">
<meta property="og:description" content="之前在blog中嵌入代码都是使用markdown格式的代码嵌入功能，这样虽然很方便但是今天在技术blog上发现一种更利于展示前端代码demo的方式，就是类似于jsbin的在线编辑器。打开jsbin官网，界面类似于界面可以直观的看到html，js，css，控制台和输出视图。可以选择各板块是否显示。 插入js，css库推荐手动找到相应库的cdn直接用标签在html板块中引入。点Add library直">
<meta property="og:locale" content="zh-Hans">
<meta property="og:image" content="https://ws1.sinaimg.cn/large/5c9d16d6ly1fg5rt1im7xj213x0l0abs.jpg">
<meta property="og:image" content="https://ws1.sinaimg.cn/large/5c9d16d6ly1fg5s7kxl5sj209z01cmx1.jpg">
<meta property="og:image" content="https://ws1.sinaimg.cn/large/5c9d16d6ly1fg5scgffbhj20c309bwfh.jpg">
<meta property="og:updated_time" content="2017-06-01T09:02:20.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="前端代码演示神器jsbin">
<meta name="twitter:description" content="之前在blog中嵌入代码都是使用markdown格式的代码嵌入功能，这样虽然很方便但是今天在技术blog上发现一种更利于展示前端代码demo的方式，就是类似于jsbin的在线编辑器。打开jsbin官网，界面类似于界面可以直观的看到html，js，css，控制台和输出视图。可以选择各板块是否显示。 插入js，css库推荐手动找到相应库的cdn直接用标签在html板块中引入。点Add library直">
<meta name="twitter:image" content="https://ws1.sinaimg.cn/large/5c9d16d6ly1fg5rt1im7xj213x0l0abs.jpg">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Mist',
    sidebar: {"position":"left","display":"post"},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://lanbos.win/2017/06/01/tools/jsfiddle_base/"/>





  <title> 前端代码演示神器jsbin | lanbos'blog </title>
</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  










  
  
    
  

  <div class="container one-collumn sidebar-position-left page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-meta ">
  

  <div class="custom-logo-site-title">
    <a href="/"  class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <span class="site-title">lanbos'blog</span>
      <span class="logo-line-after"><i></i></span>
    </a>
  </div>
  <p class="site-subtitle">这个人假装很懒，什么都没有留下</p>
</div>

<div class="site-nav-toggle">
  <button>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
  </button>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br />
            
            关于
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
  <link itemprop="mainEntityOfPage" href="http://lanbos.win/2017/06/01/tools/jsfiddle_base/">

  <span style="display:none" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <meta itemprop="name" content="lanbos">
    <meta itemprop="description" content="">
    <meta itemprop="image" content="https://ws1.sinaimg.cn/large/5c9d16d6gw1fbesf3zrhej209p09ftai.jpg">
  </span>

  <span style="display:none" itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
    <meta itemprop="name" content="lanbos'blog">
    <span style="display:none" itemprop="logo" itemscope itemtype="http://schema.org/ImageObject">
      <img style="display:none;" itemprop="url image" alt="lanbos'blog" src="">
    </span>
  </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                前端代码演示神器jsbin
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>
              <time title="Post created" itemprop="dateCreated datePublished" datetime="2017-06-01T11:19:19+08:00">
                2017-06-01
              </time>
            

            

            
          </span>

          
            <span class="post-category" >
              <span class="post-meta-divider">|</span>
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/常用工具/" itemprop="url" rel="index">
                    <span itemprop="name">常用工具</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
          

          

          
          

          

          

        </div>
      </header>
    


    <div class="post-body" itemprop="articleBody">

      
      

      
        <p>之前在blog中嵌入代码都是使用markdown格式的代码嵌入功能，这样虽然很方便但是今天在技术blog上发现一种更利于展示前端代码demo的方式，就是类似于jsbin的在线编辑器。<br>打开<a href="http://jsbin.com/?html,css,output" target="_blank" rel="external">jsbin官网</a>，界面类似于<br><img src="https://ws1.sinaimg.cn/large/5c9d16d6ly1fg5rt1im7xj213x0l0abs.jpg" alt=""><br>界面可以直观的看到html，js，css，控制台和输出视图。可以选择各板块是否显示。<br><img src="https://ws1.sinaimg.cn/large/5c9d16d6ly1fg5s7kxl5sj209z01cmx1.jpg" alt=""></p>
<h2 id="插入js，css库"><a href="#插入js，css库" class="headerlink" title="插入js，css库"></a>插入js，css库</h2><p>推荐手动找到相应库的cdn直接用标签在html板块中引入。点<code>Add library</code>直接添加不敢保证相关库的加载速度。</p>
<h2 id="接口测试"><a href="#接口测试" class="headerlink" title="接口测试"></a>接口测试</h2><p>可以用<code>jsonp</code>技术调用在线的接口来获取接口数据进行展示，当然只能是get请求，并且接口支持jsonp。</p>
<h2 id="分享"><a href="#分享" class="headerlink" title="分享"></a>分享</h2><p>编辑完代码后可以用快捷键<code>cmd+s</code>保存，然后点左上角的<code>share</code>弹出如下弹窗<br><img src="https://ws1.sinaimg.cn/large/5c9d16d6ly1fg5scgffbhj20c309bwfh.jpg" alt=""><br>即可以选择用链接分享给别人，或者用html代码嵌入到自己的网页中（其实就是iframe）展示。</p>
<h2 id="和jsfiddle对比"><a href="#和jsfiddle对比" class="headerlink" title="和jsfiddle对比"></a>和jsfiddle对比</h2><p><a href="https://jsfiddle.net/" target="_blank" rel="external">jsfiddle</a>也是很多人使用的在线编辑器。</p>
<ol>
<li>和jsfiddle对比jsbin有自带的控制台，jsfiddle需要引<code>https://getfirebug.com/firebug-lite.js</code>库来模拟一个firebug控制台。</li>
<li>jsbin分享没有暗色皮肤，可能在嵌入网站时会影响网站整体风格。</li>
<li>jsbin代码片段的管理不如jsfiddle直观。</li>
<li>两者服务器应该都是在国外，但是jsbin加载速度更快一些，jsfiddle有时会被墙，jsbin有可可靠的<code>cmd+s</code>保存快捷键，防止代码编辑到一半丢失。<br>总之jsfiddle在颜值上率胜一筹，jsbin更加实用一些。<h2 id="国内替代品"><a href="#国内替代品" class="headerlink" title="国内替代品"></a>国内替代品</h2>国内的<a href="http://runjs.cn/" target="_blank" rel="external">runjs</a>算是比较著名，但是界面丑陋功能难用，唯一的优点就是加载速度快，而且感觉是很久没有更新维护过了，不推荐使用。<br>ps： 还搜到了名字挺山寨的<a href="http://jsrun.net/" target="_blank" rel="external">jsrun</a>。。。</li>
</ol>

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        

      
    </div>


    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/工具插件/" rel="tag"># 工具插件</a>
          
        </div>
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2017/03/29/tools/tree_base/" rel="next" title="mac的终端上展示树形目录结构">
                <i class="fa fa-chevron-left"></i> mac的终端上展示树形目录结构
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2017/08/06/zhanlang2/" rel="prev" title="主旋律能不能成变奏曲？——观《战狼2》的脑洞">
                主旋律能不能成变奏曲？——观《战狼2》的脑洞 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
  </div>
  <!-- UY BEGIN -->
<div id="uyan_frame"></div>
<script type="text/javascript" src="http://v2.uyan.cc/code/uyan.js?uid=2123221"></script>
<!-- UY END -->



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="https://ws1.sinaimg.cn/large/5c9d16d6gw1fbesf3zrhej209p09ftai.jpg"
               alt="lanbos" />
          <p class="site-author-name" itemprop="name">lanbos</p>
          <p class="site-description motion-element" itemprop="description">这个人假装很懒，什么都没有留下</p>
        </div>
        <nav class="site-state motion-element">
          <div class="site-state-item site-state-posts">
            <a href="/archives">
              <span class="site-state-item-count">24</span>
              <span class="site-state-item-name">日志</span>
            </a>
          </div>

          
            <div class="site-state-item site-state-categories">
              
                <span class="site-state-item-count">5</span>
                <span class="site-state-item-name">分类</span>
              
            </div>
          

          
            <div class="site-state-item site-state-tags">
              <a href="/tags">
                <span class="site-state-item-count">16</span>
                <span class="site-state-item-name">标签</span>
              </a>
            </div>
          

        </nav>

        

        <div class="links-of-author motion-element">
          
        </div>

        
        

        
        

        


      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#插入js，css库"><span class="nav-number">1.</span> <span class="nav-text">插入js，css库</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#接口测试"><span class="nav-number">2.</span> <span class="nav-text">接口测试</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#分享"><span class="nav-number">3.</span> <span class="nav-text">分享</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#和jsfiddle对比"><span class="nav-number">4.</span> <span class="nav-text">和jsfiddle对比</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#国内替代品"><span class="nav-number">5.</span> <span class="nav-text">国内替代品</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy; 
  <span itemprop="copyrightYear">2017</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">lanbos</span>
</div>


<div class="powered-by">
  由 <a class="theme-link" href="https://hexo.io">Hexo</a> 强力驱动
</div>

<div class="theme-info">
  主题 -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT.Mist
  </a>
</div>


        

        
      </div>
    </footer>

    <div class="back-to-top">
      <i class="fa fa-arrow-up"></i>
    </div>
  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  



  
  <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.0"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.0"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.0"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.0"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.0"></script>



  



  




	




  
  

  

  

  

  


</body>
</html>
